package com.lhc.nacosprovider.controller;

import cn.hutool.core.codec.Base64Encoder;
import cn.hutool.core.io.FileUtil;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;

/**
 * @author liuchaoqun
 * @date 2022/6/22
 * @Description OCR学习
 */
@RequestMapping("/ocr")
@RestController
public class OcrController {

    @PostMapping
    public String image(MultipartFile file) throws IOException {

        // 将图片转为Base64编码
        return Base64Encoder.encode(file.getBytes());

    }

}

